<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<div class="span12 box-content">
	<div class="span12">共有${adminCount}条数据,${totalPage }页</div>
	<table class="table table-striped table-bordered" >
		<thead>
		 <tr>
		 	<th>账号</th>
		 	<th>姓名</th>
		 	<th>性别</th>
		 	<th>电话</th>
		 	<th>管理员身份</th>
		 	<th>操作</th>
		 </tr>
		</thead>
		<tbody>
		<c:forEach items="${adminList }" var="a">
			<tr>
				<td>${a.no }</td>
				<td>${a.name }</td>
				<td>${a.gender }</td>
				<td>${a.telephone}</td>
				<td>
					<c:if test="${a.superAdmin }">
						学校管理员
					</c:if>
					<c:if test="${!a.superAdmin }">
						${a.college.name } 管理员
					</c:if>
				</td>
				<td>
					<c:if test="${a.id!=user.id }">
						<button type="button" class="btn btn-danger admin_delete" data-adminId="${a.id }"  data-target="#admin_delete_box" data-toggle="modal" >
							<i class="icon-trash icon-white"></i>
							删除
						</button>
						<button type="button" class="btn btn-info admin_edit"data-adminId="${a.id }"  data-target="#admin_edit_box" data-toggle="modal" >
							<i class="icon-edit icon-white"></i>  
							编辑
						</button>
						<button type="button" class="btn btn-info admin_reset"data-adminId="${a.id }"  data-target="#admin_reset_box" data-toggle="modal" >
							<i class="icon-edit icon-white"></i>  
							重置密码
						</button>
					</c:if>
				</td>
			</tr> 
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination  pagination-centered"
			data-totalPage="${totalPage }" 
			data-currentPage="${page }" 
			data-url="<%=basePath%>admin/admin/showAdminList/{page}"
			style="display:none">
	</div>
	<div class="well">
		<button type="button" class="btn btn-primary" id="admin_add" data-target="#admin_add_box" data-toggle="modal" >
			<i class=" icon-plus icon-white"></i>  
				增加一个管理员
		</button>
	</div>
</div>
<!-- 删除确认 开始-->
<div class="modal hide fade" id="admin_delete_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3>删除管理员</h3>
	</div>
	<div class="modal-body">
		<input type="hidden" name="adminId"/>
            确认删除?删除动作不可撤销!
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">取消</a>
		<a href="#" class="btn btn-danger" id="admin_delete_box_delete">删除</a>
	</div>
</div>
<!-- 删除确认 结束 -->
<!--  信息修改 开始 -->
<div class="modal hide fade" id="admin_edit_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3>编辑管理员信息</h3>
	</div>
	<div class="modal-body">
		<form class="form-horizontal">
		<input name="adminId" type="hidden" >
		<div class="control-group">
				<label class="control-label">账号:</label>
				<div class="controls">
					<input name="no" type="text" >
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">姓名:</label>
				<div class="controls">
					<input name="name" type="text" >
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">性别:</label>
				<div class="controls">
					<input type="radio" value="男" name="gender" >男
					<input type="radio" value="女" name="gender" >女
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">电话:</label>
				<div class="controls">
					<input name="telephone" type="text" >
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">身份:</label>
				<div class="controls">
					<select name="college">
						<c:forEach items="${colleges }" var="c">
			 				<option value="${c.id }">${c.name }管理员</option>
			  			</c:forEach>
			 			<option value="0">学校管理员</option>
					</select>
				</div>
			</div>
		</form>
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">取消</a>
		<a href="#" class="btn btn-primary" id="admin_edit_box_save">保存</a>
	</div>
</div>
<!-- 信息修改 结束 -->
<!-- 重置密码 开始-->
<div class="modal hide fade" id="admin_reset_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3>重置管理员密码</h3>
	</div>
	<div class="modal-body">
		<form class="form-horizontal">
		<input name="adminId" type="hidden" >
		<div class="control-group">
				<label class="control-label">请输入密码:</label>
				<div class="controls">
					<input name="password" type="text" >
				</div>
			</div>
		</form>
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">取消</a>
		<a href="#" class="btn btn-primary" id="admin_reset_box_save">确定</a>
	</div>
</div>
<!--  重置密码  结束 -->
<!--  管理员新建 开始 -->
<div class="modal hide fade" id="admin_add_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3>新建管理员</h3>
	</div>
	<div class="modal-body">
		<form id="info_box_form" class="form-horizontal">
			<div class="control-group">
				<label class="control-label">账号:</label>
				<div class="controls">
					<input name="no" type="text" >
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">姓名:</label>
				<div class="controls">
					<input name="name" type="text" >
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">密码:</label>
				<div class="controls">
					<input name="password" type="text" >
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">性别:</label>
				<div class="controls">
					<input type="radio" value="男" name="gender" checked="checked">男
					<input type="radio" value="女" name="gender" >女
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">电话:</label>
				<div class="controls">
					<input name="telephone" type="text" >
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">身份:</label>
				<div class="controls">
					<select name="college">
						<c:forEach items="${colleges }" var="c">
			 				<option value="${c.id }">${c.name }管理员</option>
			  			</c:forEach>
			 			<option value="0">学校管理员</option>
					</select>
				</div>
			</div>
		</form>
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">取消</a>
		<a href="#" class="btn btn-primary" id="admin_add_box_save">保存</a>
	</div>
</div>
<!--  管理员新建 结束 -->